import pygame, sys, math, random
from Astroids import Astroid

class Score(pygame.sprite.Sprite):
	def __init__(self):
		self.font = pygame.font.Font(None, 20)
		self.font.set_italic(1)
		self.color = (255,255,255)
		self.lastscore = -1
		self.update()
		self.rect = self.image.get_rect().move(10, 450)
	
	def update(self, score = 0):
		width = 700
		height = 700
		asize = random.randint(25, 150)
		astroids = [Astroid("rsc/enemy/ball.png", 
					  [random.randint(-10,10), random.randint(-10,10)], 
					  [asize, asize], 
					  [random.randint(75, width-75), random.randint(75, height-75)])]
		for astroid in astroids:
			if not astroid.living:
				astroids.remove(astroid)
				score += 1
		msg = 'SCORE: ' + str(score)
		self.image = self.font.render(msg, 0, self.color)